<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="http://www.petercorke.com/RVC/common/toolboxhelp.css">
    <title>M-File Help: peak</title>
  </head>
  <body>
  <table border="0" cellspacing="0" width="100%">
    <tr class="subheader">
      <td class="headertitle">M-File Help: peak</td>
      <td class="subheader-left"><a href="matlab:open peak">View code for peak</a></td>
    </tr>
  </table>
<h1>peak</h1><p><span class="helptopic">Find peaks in vector</span></p><p>
<strong>yp</strong> = <span style="color:red">peak</span>(<strong>y</strong>, <strong>options</strong>) are the values of the maxima in the vector <strong>y</strong>.

</p>
<p>
[<strong>yp</strong>,<strong>i</strong>] = <span style="color:red">peak</span>(<strong>y</strong>, <strong>options</strong>) as above but also returns the indices of the maxima
in the vector <strong>y</strong>.

</p>
<p>
[<strong>yp</strong>,<strong>xp</strong>] = <span style="color:red">peak</span>(<strong>y</strong>, <strong>x</strong>, <strong>options</strong>) as above but also returns the corresponding
x-coordinates of the maxima in the vector <strong>y</strong>.  <strong>x</strong> is the same length of <strong>y</strong>
and contains the corresponding x-coordinates.

</p>
<h2>Options</h2>
<table class="list">
  <tr><td style="white-space: nowrap;" class="col1">'npeaks', N</td> <td>Number of peaks to return (default all)</td></tr>
  <tr><td style="white-space: nowrap;" class="col1">'scale', S</td> <td>Only consider as peaks the largest value in the horizontal
range +/- S points.</td></tr>
  <tr><td style="white-space: nowrap;" class="col1">'interp', N</td> <td>Order of interpolation polynomial (default no interpolation)</td></tr>
  <tr><td style="white-space: nowrap;" class="col1"> 'plot'</td> <td>Display the interpolation polynomial overlaid on the point data</td></tr>
</table>
<h2>Notes</h2>
<ul>
  <li>To find minima, use PEAK(-V).</li>
  <li>The interp options fits points in the neighbourhood about the peak with
an N'th order polynomial and its peak position is returned.  Typically
choose N to be odd.</li>
</ul>
<h2>See also</h2>
<p>
<a href="matlab:doc peak2">peak2</a></p>
<hr>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
  <tr class="subheader" valign="top"><td>&nbsp;</td></tr></table>
<p class="copy">&copy; 1990-2012 Peter Corke.</p>
</body></html>